//设置网页标题

let routerTitle = ""; //存放路由标题
let siteTitle = ""; //存放全局标题;

function setTitle() {
	if (!routerTitle && !siteTitle) {
		document.title = "加载中";
	} else if (routerTitle && !siteTitle) {
		document.title = routerTitle;
	} else if (siteTitle && !routerTitle) {
		document.title = siteTitle;
	} else {
		document.title = routerTitle + "-" + siteTitle;
	}
}

export default {
	setrouterTitle(title) {
		routerTitle = title;
		setTitle();
	},
	setsiteTitle(title) {
		siteTitle = title;
		setTitle();
	},
};
